<?php
class modules_default_forms_CalendarDateForm extends forms_FormBase
{
	/**
	 * Init
	 * @see Zend/Zend_Form#init()
	 */
	public function init()
	{
		$oMonthElement = new Zend_Form_Element_Select('month');
		$oMonthElement->setRegisterInArrayValidator(false);
		$oMonthElement = $this->_initDefaultFiltersAndValidators($oMonthElement);
//		$oMonthElement->addFilter(new Lemar_Filter_DefaultValueFromPossible(array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'), '1'));
		$oMonthElement->addValidator(new Zend_Validate_Between(1,12,date('m')));
		$oMonthElement->addValidator(new Zend_Validate_Digits());
		$this->addElement($oMonthElement);

		$oYearElement = new Zend_Form_Element_Select('year');
		$oYearElement->setRegisterInArrayValidator(false);
		$oYearElement = $this->_initDefaultFiltersAndValidators($oYearElement);
		$oYearElement->addFilter(new Lemar_Filter_DefaultValueFromPossible(Lemar_Calendar::getYears(), date('Y') ));
		$oYearElement->addValidator(new Zend_Validate_Digits());
		$this->addElement($oYearElement);

		$oDayElement = new Zend_Form_Element_Select('day');
		$oDayElement->setRegisterInArrayValidator(false);
		$oDayElement = $this->_initDefaultFiltersAndValidators($oDayElement);
        $oDayElement->addValidator(new Zend_Validate_Between(1,31,date('d')));
		$oDayElement->addValidator(new Zend_Validate_Digits());
		$this->addElement($oDayElement);

		$oIdElement = new Zend_Form_Element_Text('id');
		$oIdElement = $this->_initDefaultFiltersAndValidators($oIdElement,false);
		$oIdElement->addValidator(new Zend_Validate_Digits());
		$this->addElement($oIdElement);

		$oTextElement = new Zend_Form_Element_Text('text');
		$oTextElement = $this->_initDefaultFiltersAndValidators($oTextElement);
		$this->addElement($oTextElement);
	}
}